#include<stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
#include <string.h>
#define READSIZE 4096

int main(int argc,char *argv[]){
	int rlen=0;  //wenjianneirongchangdu
	int nline=10;  //duquwenjianhangshu
	int nent=0;  //jishuqi
	int rfd; //wenjianmiaoshufu
	int i,j;
	char rbuf[READSIZE];  //duquwenjianhuancunqu
	char *filename;
	char *pb=0;  //zhixiangmeihanghuanhang
	memset(rbuf,0,READSIZE);
	filename=argv[1];
	rfd=open(argv[1],O_RDONLY,0);
	
	if((rlen=read(rfd,rbuf,READSIZE))>0)
//close(rfd);
{


                for(i=0;i<rlen;i++)
			{
				if(rbuf[i]=='\n')
				{
					pb=&rbuf[i];
					if(++nent==10)
					break;
				
				}
			}
//		memset(rbuf,0,READSIZE);}
		close(rfd);	
	for(j=0;j<=i;j++)
{

printf("%c",rbuf[j]);
}
}
}	
